package newtank.network.server.handler;

import io.netty.channel.ChannelHandlerContext;
import newtank.data.ShootSignal;
import newtank.network.server.registry.ChannelRegistry;
import server.netty.GpcDataPackage;

/**
 * @author lijiahao
 * @since 2022/3/19
 */
public class ShootDataHandler extends AbstractDataHandler {

    @Override
    public void handle(ChannelHandlerContext ctx, GpcDataPackage data) {
        ShootSignal shootSignal = new ShootSignal(data.getUnique());
        shootSignal.setLength(data.getLength());
        shootSignal.setCode(data.getCode());
        shootSignal.setContext(data.getContext());
        shootSignal.setUnique(data.getUnique());
        shootSignal.setRouteRequest(data.getRouteRequest());
        shootSignal.setStatus(data.getStatus());
        ChannelRegistry.inform(shootSignal);
    }
}
